import java.util.Scanner;

public class DAY0405 {
    //节点
    static class Node{
        int value;
        Node next;
        public Node(int value) {
            this.value=value;
        }
    }

    public static void main1(String[] args) {
        //获取链表长度
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        //消掉\n
        scanner.nextLine();
        //获取链表的值
        String value=scanner.nextLine();
        String[] value1=value.split(" ");
        //创建链表（未反转前
        Node ph=new Node(-1);
        Node t = ph;
        for (int i = 0; i < n; i++) {
            Node node=new Node(Integer.parseInt(value1[i]));
            t.next=node;
            t=node;
        }
        //获取端点
        String port=scanner.nextLine();
        int left=Integer.parseInt(port.split(" ")[0]);
        int right=Integer.parseInt(port.split(" ")[1]);
        //反转链表
        Node newHead= Reversal(ph.next,left,right);
        //输出操作
        while (newHead!=null){
            System.out.println(newHead.value+" ");
            newHead=newHead.next;
        }
    }

    //反转链表
    private static Node Reversal(Node head, int left, int right) {
        //虚拟头节点
        Node ph=new Node(-1);
        ph.next=head;
        //前驱节点
        Node pr=ph;
        //开始反转的位置
        for (int i = 1; i <left ; i++) {
            pr=pr.next;
        }
        //开始反转
        Node cur=pr.next;
        for (int i = left; i <right ; i++) {
            Node t=cur.next;
            cur.next=t.next;
            t.next=pr.next;
            pr.next=t;
        }
        return ph.next;
    }


    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            //猴子数量
            int n=scanner.nextInt();
            if(n==0){
                break;
            }
            //最开始的桃子数量
            int num=(int)Math.pow(5,n)-4;
            //老猴子最后拥有的桃子数量
            int sum=(int)Math.pow(4,n)+n-4;
            System.out.println(num+" "+sum);

        }
    }

    public int reverseInteger(int number) {
        // write your code here
        int ret = 0, sign = number > 0 ? 1 : -1;
        while (number > 0) {
            ret *= 10;
            ret += number % 10;
            number /= 10;
        }
        return ret * sign;
    }

    public double[] calculate(int r) {
        // write your code here
        double pi=3.14;
        double[] array=new double[2];
        array[0]=2*r*pi;
        array[1]=r*r*pi;
        return array;
    }

    public boolean canWinBash(int n) {
        // Write your code here
        return n%4!=0;
    }
}
